﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Positionen_in_Textdatei
{
    class Program
    {
        static void Main(string[] args)
        {
            using(var fs = new FileStream("textfile1.txt", FileMode.Open, FileAccess.Read))
            {
                using (var sr = new StreamReader(fs, Encoding.Default, true, 2))
                {
                    while (!sr.EndOfStream)
                    {
                        Console.WriteLine(sr.BaseStream.Position);
                        Console.WriteLine("  {0}", sr.ReadLine());
                    }
                }

                //byte[] buffer = new byte[5];
                //int n = 0;
                //do
                //{
                //    Console.WriteLine(fs.Position);
                //    n = fs.Read(buffer, 0, buffer.Length);
                //    Console.WriteLine("  {0}", n);
                //} while (n == buffer.Length);
            }

            //using (var sr = new StreamReader("TextFile1.txt"))
            //{
            //    while (!sr.EndOfStream)
            //    {
            //        Console.WriteLine(sr.BaseStream.Position);
            //        Console.WriteLine(sr.ReadLine());
            //    }
            //}
        }
    }
}
